import os
import sys

curdir = os.path.dirname(os.path.abspath(__file__))

node_list = [
]

listen_channel = {
                    'port' : 20060
                 }

recv_timeout = 30

#max_cache_size = 2

aggregator = { 'enabled' : 0,
               'time_to_aggregate' : 10
             }

dbpath = '/tmp/rrd'
db = {
        'host' : '127.0.0.1',
        'port' : 7890,
        'root_dir' : dbpath,
        'max_cache_size' : 30,
        'write_back_chunk_size' : 2
     }

#ofile = curdir + os.path.sep + 'monc.out'
#pfile = curdir + os.path.sep + 'monc.pid'
ofile = '/tmp/monc.out'
pfile = '/tmp/monc.pid'

#logfile = curdir + os.path.sep + 'monc.log'
logfile = '/tmp/monc.log'

all = { 
    'ofile'         :   ofile,
    'pfile'         :   pfile,
    'logfile'       :   logfile,
    'node_list' : node_list,
    'listen_channel' : listen_channel,
    'recv_timeout' : recv_timeout,
    'aggregator' : aggregator,
    'db' : db
}

if __name__ == '__main__':
    config_path = os.path.dirname(os.path.abspath(__file__)) + os.path.sep + \
            'center_default_config'
    fp = file(config_path, 'w+')
    import json
    json.dump(all, fp, sort_keys=True, indent=2)
    fp.seek(0)
    print json.load(fp, encoding=sys.getdefaultencoding())
    fp.close()
